package com.glodon.paas.account.dao.mysql;

import org.springframework.beans.factory.annotation.Autowired;

import com.glodon.paas.account.dao.ContactDao;
import com.glodon.paas.account.dao.domain.ContactEntity; 
import com.glodon.paas.account.dao.mapper.ContactEntityMapper;

public class ContactDaoMysqlImpl  implements ContactDao {
	@Autowired
	private ContactEntityMapper contactEntityMapper;
	
	@Override
	public String insert(ContactEntity entity) {
		contactEntityMapper.insertSelective(entity);
		return entity.getId();
	}

	@Override
	public ContactEntity get(String id) {
		return contactEntityMapper.selectByPrimaryKey(id);
	}

	@Override
	public int delete(String id) {
		return contactEntityMapper.deleteByPrimaryKey(id);
	}

	@Override
	public void update(ContactEntity address) {
		contactEntityMapper.updateByPrimaryKeySelective(address);
	}
}
